#pragma once

/* basic config file:
# comment
<category>
	value1 = 123
	value2 = 567

<category2>
	blub = 467


will be stored within std::map<std::string [category], std::map<std::string [varName], std::string [varValue]>>
access:
std::string value = config.GetTokenValue("category", "value1");
*/
	
typedef std::map<std::string, std::map<std::string, std::string>> tokens_t;
class Config
{
private:

	enum ParserState
	{
		State_None,
		State_Category,
		State_Keyword,
		State_Value,
	};

	std::fstream m_infile;
	ParserState m_state;
	tokens_t m_tokens;
public:
	Config(std::string filePath);

	const std::string& GetTokenValue(const std::string& category, const std::string& tokenName) const;
	const uint32 getUInt32(const std::string& category, const std::string& tokenName) const;
	const int32 getInt32(const std::string& category, const std::string& tokenName) const;
	const float getFloat(const std::string& category, const std::string& tokenName) const;
	const bool getBoolean(const std::string& category, const std::string& tokenName) const;
	const std::string& getString(const std::string& category, const std::string& tokenName) const { return GetTokenValue(category, tokenName); }
	
	tokens_t::iterator begin() { return m_tokens.begin(); }
	tokens_t::iterator end() { return m_tokens.end(); }
};